<template>
  <div>
    <p>{{ count }}</p>
    <button @click="count++">+</button>
  </div>
</template>

<script>
export default {
  name: "Tab",
  data() {
    return {
      count: 0,
    };
  },
  watch: {
    count: {
      deep: true,
      handler() {
        // $emit可以获取到事件 第二个参数是要传的值
        this.$emit("fn", this.count);
      },
    },
  },
};
</script>

<style>
</style>